/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controllers;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import vo.PropertiesVO;

/**
 *
 * @author julianDavidPG
 */
public class PropertiesControl {
    
    private static String HOST;
    private static String PORT;
    private static String RESOURCE;
    private static final String SATACREDITO_PATH = "SATACREDITO_PATH";    
    private static final String FILE_PATH = "config/webService";    
    private static final String FILE_NAME = "ws";

    public static PropertiesVO localProperties() throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream(System.getenv(SATACREDITO_PATH) + "/" +
                                            FILE_PATH + "/" + FILE_NAME + ".properties"));
        PropertiesVO pvo = new PropertiesVO();
        pvo.setHost(properties.getProperty(HOST));
        pvo.setPort(new Integer(properties.getProperty(PORT)));
        pvo.setResource(properties.getProperty(RESOURCE));
        return pvo;
    }
    
    public static String getHOST() {
        return HOST;
    }

    public static void setHOST(String HOST) {
        PropertiesControl.HOST = HOST;
    }

    public static String getPORT() {
        return PORT;
    }

    public static void setPORT(String PORT) {
        PropertiesControl.PORT = PORT;
    }

    public static String getRESOURCE() {
        return RESOURCE;
    }

    public static void setRESOURCE(String RESOURCE) {
        PropertiesControl.RESOURCE = RESOURCE;
    }

    
    
    
}
